package com.gxa.order.controller.hotel;

import com.gxa.common.commons.R;
import com.gxa.order.pojo.hotel.Room;
import com.gxa.order.service.RoomService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;

@RestController
@RequestMapping(value = "/room")
public class RoomController {
    @Resource
    private RoomService roomService;
    /**
     * 添加房间
     * @param room
     * @return
     */
    @PostMapping(value = "/addRoom")
    public R addRoom(@RequestBody Room room){
        return roomService.addRoom(room);
    }
    /**
     * 查询酒店全部房间
     * @param hotelId
     * @return
     */
    @GetMapping(value = "/queryRoom")
    public R queryRoom(@Param("hotel") Integer hotelId, @Param("typeName") String typeName){
        return roomService.queryRoom(hotelId,typeName);
    }

    /**
     * 修改房间
     * @param room
     * @return
     */
    @PostMapping(value = "/updateRoom")
    public R updateRoom(@RequestBody Room room){
        return roomService.updateRoom(room);
    }
    /**
     * 上下架房间
     * @param roomId
     * @return
     */
    @GetMapping(value = "/downRoom")
    public R downRoomType(Integer roomId){
        return roomService.downRoom(roomId);
    }
}
